package com.ruoyi.baseData.controller;


import com.ruoyi.baseData.domain.dto.ShiftDto;
import com.ruoyi.baseData.service.ShiftService;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

@RestController
@RequestMapping("/shift")
public class ShiftController {
    @Autowired
    ShiftService shiftService;

    @PostMapping("/getShiftByPage")
    public R export(@RequestBody ShiftDto materialDto)
    {
        return R.ok(shiftService.getShiftByPage(materialDto));
    }

    @PostMapping("/addShift")
    public R addTest(@RequestBody ShiftDto materialDto) throws ParseException {
        shiftService.addShift(materialDto);
        return R.ok("添加成功");
    }

    @PostMapping("/delShift")
    public R delTest(@RequestBody ShiftDto materialDto){
        shiftService.delShift(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateShift")
    public R updateTest(@RequestBody ShiftDto materialDto){
        shiftService.updateShift(materialDto);
        return R.ok("锁定成功");
    }
}
